/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package conventus;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Douglas Tybel
 */
@Entity
@Table(name = "situacoes", catalog = "conventus", schema = "")
@NamedQueries({
    @NamedQuery(name = "Situacoes.findAll", query = "SELECT s FROM Situacoes s"),
    @NamedQuery(name = "Situacoes.findByCodSituacao", query = "SELECT s FROM Situacoes s WHERE s.codSituacao = :codSituacao"),
    @NamedQuery(name = "Situacoes.findBySituacao", query = "SELECT s FROM Situacoes s WHERE s.situacao = :situacao"),
    @NamedQuery(name = "Situacoes.findByInicio", query = "SELECT s FROM Situacoes s WHERE s.inicio = :inicio"),
    @NamedQuery(name = "Situacoes.findByFim", query = "SELECT s FROM Situacoes s WHERE s.fim = :fim")})
public class Situacoes implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "COD_SITUACAO")
    private Integer codSituacao;
    @Basic(optional = false)
    @Column(name = "SITUACAO")
    private String situacao;
    @Basic(optional = false)
    @Column(name = "INICIO")
    private String inicio;
    @Basic(optional = false)
    @Column(name = "FIM")
    private String fim;
    @OneToMany(mappedBy = "codSituacao")
    private List<Atas> atasList;

    public Situacoes() {
    }

    public Situacoes(Integer codSituacao) {
        this.codSituacao = codSituacao;
    }

    public Situacoes(Integer codSituacao, String situacao, String inicio, String fim) {
        this.codSituacao = codSituacao;
        this.situacao = situacao;
        this.inicio = inicio;
        this.fim = fim;
    }

    public Integer getCodSituacao() {
        return codSituacao;
    }

    public void setCodSituacao(Integer codSituacao) {
        Integer oldCodSituacao = this.codSituacao;
        this.codSituacao = codSituacao;
        changeSupport.firePropertyChange("codSituacao", oldCodSituacao, codSituacao);
    }

    public String getSituacao() {
        return situacao;
    }

    public void setSituacao(String situacao) {
        String oldSituacao = this.situacao;
        this.situacao = situacao;
        changeSupport.firePropertyChange("situacao", oldSituacao, situacao);
    }

    public String getInicio() {
        return inicio;
    }

    public void setInicio(String inicio) {
        String oldInicio = this.inicio;
        this.inicio = inicio;
        changeSupport.firePropertyChange("inicio", oldInicio, inicio);
    }

    public String getFim() {
        return fim;
    }

    public void setFim(String fim) {
        String oldFim = this.fim;
        this.fim = fim;
        changeSupport.firePropertyChange("fim", oldFim, fim);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codSituacao != null ? codSituacao.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Situacoes)) {
            return false;
        }
        Situacoes other = (Situacoes) object;
        if ((this.codSituacao == null && other.codSituacao != null) || (this.codSituacao != null && !this.codSituacao.equals(other.codSituacao))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "conventus.Situacoes[ codSituacao=" + codSituacao + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
